#include "main.h"

/* 
 * ===  FUNCTION  ======================================================================
 *         Name:  is_token_start
 *  Description:  
 *  Return: TRUE if token start, unless FALSE
 * =====================================================================================
 */
gboolean is_token_start (gchar ch)
{
  return (ch == '[' || ch == '{' || ch == '<') ? TRUE:FALSE;
}


/* 
 * ===  FUNCTION  ======================================================================
 *         Name:  is_token_end
 *  Description:  
 * =====================================================================================
 */
gboolean is_token_end (gchar ch)
{
  return (ch == ']' || ch == '}' || ch == '>') ? TRUE:FALSE;
}


/* 
 * ===  FUNCTION  ======================================================================
 *         Name:  is_mutex_clean
 *  Description:  check mutex is removed from expression
 *  Return: 0 if not contain any mutext token, unless return 1
 * =====================================================================================
 */
gint is_mutex_clean (GString *expr)
{
  return g_strrstr (expr->str, "|") ? 1:0;
}


/* 
 * ===  FUNCTION  ======================================================================
 *         Name:  is_brace_clean
 *  Description:  check brace is removed from expression
 *  Return: 0 if not contain any brace token, unless return 1
 * =====================================================================================
 */
gint is_brace_clean (GString *expr)
{
  return g_strrstr (expr->str, "[") || g_strrstr (expr->str, "]") ? 1:0;
}


/* 
 * ===  FUNCTION  ======================================================================
 *         Name:  is_curly_clean
 *  Description:  check curly is removed from expression
 *  Return: 0 if not contain any curly token, unless return 1
 * =====================================================================================
 */
gint is_curly_clean (GString *expr)
{
  return g_strrstr (expr->str, "{") || g_strrstr (expr->str, "}") ? 1:0;
}


/* 
 * ===  FUNCTION  ======================================================================
 *         Name:  is_angle_clean
 *  Description:  
 * =====================================================================================
 */
gint is_angle_clean (GString *expr)
{
  return g_strrstr (expr->str, "<") || g_strrstr (expr->str, ">") ? 1:0;
}
